import React from 'react';
import {Button, ScrollView, StyleSheet, Text} from 'react-native';
import {useDispatch, useSelector} from 'react-redux';
import {getMovieData} from '../store/features/movieSlice';

const Movie = () => {
  const {list} = useSelector(store => store.movie);
  const dispatch = useDispatch();
  return (
    <ScrollView contentContainerStyle={styles.container}>
      <Text>{JSON.stringify(list)}</Text>
      <Button title={'load Data'} onPress={() => dispatch(getMovieData())} />
    </ScrollView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: '#ffffff',
  },
  textInput: {
    width: 200,
    height: 40,
    borderWidth: 1,
    borderColor: '#eeeeee',
    borderStyle: 'solid',
    borderRadius: 4,
    marginTop: 10,
    paddingLeft: 10,
  },
  btns: {
    flexDirection: 'row',
  },
});

export default Movie;
